package youdu

import "fmt"

func TestouduDeptClear(deptId int) {
	org := Org{
		Buin:          16119803,
		Server:        "https://192.168.2.40:7443",
		AppId:         "sysOrgAssistant",
		EncodedAesKey: "+OdFq9XE88dqowIXmKWj7sebL9LxHCRPhHnO8GPo/jo=",
	}
	// 列出所有部门
	deptList, err := org.DepartmentListGet(deptId)
	if err != nil {
		fmt.Println("测试有度数据库失败：", err.Error())
		return
	}
	fmt.Println(deptList)
	err = org.DeptClear(deptId)
	if err != nil {
		fmt.Println("测试有度数据库失败：", err.Error())
		return
	}
	fmt.Println("测试有度数据库成功")
}

func TestyouduDB() {
	sso := Sso{
		Buin:            16126317,
		Server:          "http://121.229.102.17:7080",
		Secret:          "1E54B9B8FE1BAF992BE63EB637622A81",
		YouduDBServer:   "100.109.74.123",
		YouduDBPort:     "3306",
		YouduDBUser:     "root",
		YouduDBPassword: "root",
	}
	err := sso.SaveSecret()
	if err != nil {
		fmt.Println("测试有度数据库失败：" + err.Error())
		return
	}
	token, err := sso.GetLoginLink("vi")
	if err != nil {
		fmt.Println("测试有度数据库失败：" + err.Error())
		return
	}
	fmt.Println("测试有度数据库成功：" + token)
}
